<!doctype html>
<html>

<head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
    <title>首页</title>
    <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap@4.4.1/dist/css/bootstrap.min.css">
    <link rel="stylesheet" href="//at.alicdn.com/t/font_1658828_vud4w73neg.css">
    <link rel="stylesheet" href="/admin/css/style.css">
</head>

<body class="bg-light">
    <%- include('../header.html') -%>

        <div class="container-fluid vh-100">
            <div class="row h-100">
                <%- include('../navs.html') -%>
                    <div class="col-10">
                        <div class="p-3 border mb-3 bg-white">
                            <h4 class="mb-0">我的选题</h4>
                        </div>
                        <div class="row mt-3">
                            <div class="col">
                                <div class="card">
                                    <div class="card-header bg-primary text-white d-flex justify-content-between">
                                        <h6 class="mb-0 align-self-center">选题列表</h6>
                                    </div>
                                    <div class="card-body">
                                        <% if (!getres) { %>

                                            <form action="/admin/mytopic/addAid" method="POST"
                                                enctype="multipart/form-data">
                                                <input type="hidden" name="uid" value="<%= user.uid %>">
                                                <div class="form-row">
                                                    <label for="aid"
                                                        class="col-2 text-center col-form-label mb-1">第一个选题：</label>
                                                    <input type="text" class="col-1 form-control one" name="aid" id="aid"
                                                        value="<%= info.aid ? info.aid : '' %>" placeholder="题目ID号">
                                                    <h6 class="text-center col-form-label ml-2">题目： <%
                                                            mytopics.forEach(mytopic=> { %>
                                                            <% if (mytopic.id==info.aid ) { %>
                                                                <%= mytopic.title %>
                                                                    <span
                                                                        class="float-right text-center ml-5">请耐心等待结果</span>
                                                                    <% } %>
                                                                        <% }) %>
                                                    </h6>
                                                </div>
                                                <div class="form-row">
                                                    <label for="aid2"
                                                        class="col-2 text-center col-form-label mb-1">第二个选题：</label>
                                                    <input type="text" class="col-1 form-control two" name="aid2" id="aid2"
                                                        value="<%= info.aid2 ? info.aid2 : '' %>" placeholder="题目ID号">
                                                    <h6 class="text-center col-form-label ml-2">题目： <%
                                                            mytopics.forEach(mytopic=> { %>
                                                            <% if (mytopic.id==info.aid2 ) { %>
                                                                <%= mytopic.title %>
                                                                    <span
                                                                        class="float-right text-center ml-5">请耐心等待结果</span>
                                                                    <% } %>
                                                                        <% }) %>
                                                    </h6>
                                                </div>
                                                <div class="form-row">
                                                    <label for="aid3"
                                                        class="col-2 text-center col-form-label mb-1">第三个选题：</label>
                                                    <input type="text" class="col-1 form-control three" name="aid3" id="aid3"
                                                        value="<%= info.aid3 ? info.aid3 : '' %>" placeholder="题目ID号">
                                                    <h6 class="text-center col-form-label ml-2">题目： <%
                                                            mytopics.forEach(mytopic=> { %>
                                                            <% if (mytopic.id==info.aid3 ) { %>
                                                                <%= mytopic.title %>
                                                                    <span
                                                                        class="float-right text-center ml-5">请耐心等待结果</span>
                                                                    <% } %>
                                                                        <% }) %>
                                                    </h6>
                                                </div>
                                                <div class="form-row mt-3">
                                                    <div class="offset-2">
                                                        <input type="submit" value="确认/修改" class="btn btn-success todo"><span class="msg" style="color: red;margin-left: 20px;"></span>
                                                    </div>
                                                </div>
                                            </form>
                                            <% } %>
                                                <% if (getres) { %>

                                                    <div class="mt-3">
                                                        <p>最终选题结果：<br>题目ID：<%= getres.id %> 题目名称：<%= getres.title %>
                                                                    <br>指导老师： <%= getres.tname %> 联系方式： <%=
                                                                            getres.tphone %>
                                                        </p>
                                                    </div>
                                                    <% } %>

                                    </div>
                                </div>
                            </div>
                        </div>
                    </div>
            </div>
        </div>

        <script src="https://cdn.jsdelivr.net/npm/jquery@3.4.1/dist/jquery.min.js"></script>
        <script src="https://cdn.jsdelivr.net/npm/popper.js@1.16.0/dist/umd/popper.min.js"></script>
        <script src="https://cdn.jsdelivr.net/npm/bootstrap@4.4.1/dist/js/bootstrap.min.js"></script>
        <script src="https://cdnjs.cloudflare.com/ajax/libs/holder/2.9.6/holder.min.js"></script>
        <script src="https://gw.alipayobjects.com/os/lib/antv/g2/3.5.12/dist/g2.min.js"></script>
        <script src="https://gw.alipayobjects.com/os/antv/pkg/_antv.data-set-0.10.2/dist/data-set.min.js"></script>
        <script src="/admin/js/public.js"></script>
        <script>
            $(document).ready( function() {
                $("input").change(function () {
                    if (($(".one").val()==$(".two").val())||($(".one").val()==$(".three").val())||($(".two").val()==$(".three").val())) {
                        $(".msg").text("ID有重复，请重新输入！");
                    }else{
                        $(".msg").text("");
                    }
                });
            });
        </script>
</body>

</html>